<template>
  <div>
    <a-config-provider :locale="locale">
        <div style="font-size: 14pt; margin-bottom: 10px"><span style="font-weight: bold; ">编号：</span>{{ formData.applyCode.componentProp.defaultValue }}</div>
        <div style="font-size:18pt;text-align: center;font-weight: bold;margin-bottom:50px">中电翼康科技有限公司业务招待审批表</div>
        <a-form ref="vForm" :model="formData" hideRequiredMark>
          <table border="1" cellspacing="0" cellpadding="0" style="width: 100%;" class="yk_table">
            <tr>
              <td><span style="font-weight: bold; ">申请部门</span></td>
              <td>
                <a-form-item :label="formData.applyUserDeptName.label" class="hideLabel"
                  :name="[formData.applyUserDeptName.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.applyUserDeptName.componentProp.hidden" :rules="formData.applyUserDeptName.rules">
                  <a-input v-model:value="formData.applyUserDeptName.componentProp.defaultValue"
                    :disabled="formData.applyUserDeptName.componentProp.disabled"
                    :placeholder="formData.applyUserDeptName.componentProp.placeholder" />
                </a-form-item>
              </td>
              <td><span style="font-weight: bold; ">申请人</span></td>
              <td>
                <a-form-item :label="formData.applyUserName.label" class="hideLabel"
                  :name="[formData.applyUserName.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.applyUserName.componentProp.hidden" :rules="formData.applyUserName.rules">
                  <a-input v-model:value="formData.applyUserName.componentProp.defaultValue"
                    :disabled="formData.applyUserName.componentProp.disabled"
                    :placeholder="formData.applyUserName.componentProp.placeholder" />
                </a-form-item>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">申请日期</span></td>
              <td>
                <a-form-item :label="formData.applyTime.label" class="hideLabel"
                  :name="[formData.applyTime.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.applyTime.componentProp.hidden" :rules="formData.applyTime.rules">
                  <a-date-picker v-model:value="formData.applyTime.componentProp.defaultValue"
                    :disabled="formData.applyTime.componentProp.disabled"
                    :placeholder="formData.applyTime.componentProp.placeholder" show-time type="date"
                    style="width: 100%;" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm" />
                </a-form-item>
              </td>
              <td><span style="font-weight: bold; ">计划接待时间</span></td>
              <td>
                <a-form-item :label="formData.planTime.label" class="hideLabel"
                  :name="[formData.planTime.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.planTime.componentProp.hidden" :rules="formData.planTime.rules">
                  <a-date-picker v-model:value="formData.planTime.componentProp.defaultValue"
                    :disabled="formData.planTime.componentProp.disabled"
                    :placeholder="formData.planTime.componentProp.placeholder" show-time type="date"
                    style="width: 100%;" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm" />
                </a-form-item>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">接待地点</span></td>
              <td colspan="3">
                <a-form-item :label="formData.fromAddress.label" class="hideLabel"
                  :name="[formData.fromAddress.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.fromAddress.componentProp.hidden" :rules="formData.fromAddress.rules">
                  <a-textarea v-model:value="formData.fromAddress.componentProp.defaultValue" auto-size
                    :disabled="formData.fromAddress.componentProp.disabled"
                    style="width: 100% !important;vertical-align: top;"
                    :placeholder="formData.fromAddress.componentProp.placeholder" />
                </a-form-item>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">接待事由</span></td>
              <td>
                <a-form-item :label="formData.reason.label" class="hideLabel"
                  :name="[formData.reason.field, 'componentProp', 'defaultValue']" hideLabel
                  v-if="!formData.reason.componentProp.hidden" :rules="formData.reason.rules">
                  <a-textarea v-model:value="formData.reason.componentProp.defaultValue" auto-size
                    :disabled="formData.reason.componentProp.disabled"
                    :placeholder="formData.reason.componentProp.placeholder" />
                </a-form-item>
              </td>
              <td><span style="font-weight: bold; ">费用归属</span></td>
              <td>
                <a-form-item :label="formData.costBelong.label" class="hideLabel"
                  :name="[formData.costBelong.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.costBelong.componentProp.hidden" :rules="formData.costBelong.rules">
                  <a-select v-model:value="formData.costBelong.componentProp.defaultValue"
                    :disabled="formData.costBelong.componentProp.disabled"
                    :placeholder="formData.costBelong.componentProp.placeholder" @change="costBelongChange"
                    :options="formData.costBelong.componentProp.option" allowClear>
                  </a-select>
                </a-form-item>
              </td>
            </tr>
            <tr v-if="costBelongValue || costBelongValue == '0'">
              <td><span style="font-weight: bold; ">商机/项目/产品名称</span></td>
              <td :colspan="costBelongValue != '0' ? '1' : '3'">
                <a-form-item :label="formData.belongName.label" class="hideLabel"
                  :name="[formData.belongName.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.belongName.componentProp.hidden" :rules="formData.belongName.rules">
                  <a-textarea v-model:value="formData.belongName.componentProp.defaultValue"
                    :disabled="formData.belongName.componentProp.disabled"
                    :placeholder="formData.belongName.componentProp.placeholder" auto-size
                    :style="costBelongValue != '0' && !formData.belongBtn.componentProp.hidden ? 'width: calc(100% - 60px)' : '100%'">
                  </a-textarea>
                  <!-- <a-input v-model:value="formData.belongName.componentProp.defaultValue"
                  :disabled="formData.belongName.componentProp.disabled"
                  :placeholder="formData.belongName.componentProp.placeholder"
                  :style="costBelongValue != '0' ? 'width: calc(100% - 60px)' : '100%'" /> -->
                  <a-button v-if="costBelongValue != '0' && !formData.belongBtn.componentProp.hidden" type="primary"
                    size="small" class="no-form-button" style="vertical-align: top;margin-left: 10px;width: 48px;"
                    @click="belongClick">选择</a-button>
                </a-form-item>
              </td>
              <td v-if="costBelongValue != '0'"><span style="font-weight: bold; ">商机/项目/产品编码</span></td>
              <td v-if="costBelongValue != '0'">
                <a-form-item :label="formData.belongCode.label" class="hideLabel"
                  :name="[formData.belongCode.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.belongCode.componentProp.hidden" :rules="formData.belongCode.rules">
                  <a-textarea v-model:value="formData.belongCode.componentProp.defaultValue"
                    :disabled="formData.belongCode.componentProp.disabled"
                    :placeholder="formData.belongCode.componentProp.placeholder" auto-size>
                  </a-textarea>
                </a-form-item>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">就餐总人数</span></td>
              <td>
                <a-form-item :label="formData.persons.label" class="hideLabel"
                  :name="[formData.persons.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.persons.componentProp.hidden" :rules="formData.persons.rules">
                  <a-input-number v-model:value="formData.persons.componentProp.defaultValue"
                    @change="budgetChange(formData.money.componentProp.defaultValue,formData.persons.componentProp.defaultValue)"
                    :disabled="formData.persons.componentProp.disabled"
                    :placeholder="formData.persons.componentProp.placeholder" />
                </a-form-item>
              </td>
              <td><span style="font-weight: bold; ">人均标准</span></td>
              <td>
                <a-form-item :label="formData.money.label" class="hideLabel"
                  :name="[formData.money.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.money.componentProp.hidden" :rules="formData.money.rules">
                  <a-select v-model:value="formData.money.componentProp.defaultValue"
                    :disabled="formData.money.componentProp.disabled"
                    :placeholder="formData.money.componentProp.placeholder" 
                    @change="budgetChange(formData.money.componentProp.defaultValue,formData.persons.componentProp.defaultValue)"
                    :options="formData.money.componentProp.option" allowClear>
                  </a-select>
                </a-form-item>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">费用预算</span></td>
              <td colspan="3">
                <a-form-item :label="formData.budget.label" class="hideLabel"
                  :name="[formData.budget.field, 'componentProp', 'defaultValue']"
                  v-if="!formData.budget.componentProp.hidden" :rules="formData.budget.rules">
                  <a-input-number v-model:value="formData.budget.componentProp.defaultValue"
                    :disabled="formData.budget.componentProp.disabled"
                    :placeholder="formData.budget.componentProp.placeholder" />
                </a-form-item>
              </td>
            </tr>
            
            <tr>
              <td><span style="font-weight: bold; ">部门负责人意见</span></td>
              <td colspan="3">
                <a-form-item :label="formData.deptManagerContent.label" class="hideLabel" :name="[
      formData.deptManagerContent.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.deptManagerContent.componentProp.hidden" :rules="formData.deptManagerContent.rules">
                  <a-textarea v-model:value="formData.deptManagerContent.componentProp.defaultValue"
                    :disabled="formData.deptManagerContent.componentProp.disabled"
                    :placeholder="formData.deptManagerContent.componentProp.placeholder" />
                </a-form-item>
                <div style="float: right; margin-top: 10px;">
                  <a-row :gutter="16">
                    <a-col :span="12">
                      <a-form-item label="签字" class=""
                        :name="[formData.deptManagerSign.field, 'componentProp', 'defaultValue']"
                        v-if="!formData.deptManagerSign.componentProp.hidden" :rules="formData.deptManagerSign.rules">
                        <a-input v-model:value="formData.deptManagerSign.componentProp.defaultValue"
                          :disabled="formData.deptManagerSign.componentProp.disabled"
                          :placeholder="formData.deptManagerSign.componentProp.placeholder" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item :label="formData.deptManagerDate.label" class="hideLabel"
                        :name="[formData.deptManagerDate.field, 'componentProp', 'defaultValue']"
                        v-if="!formData.deptManagerDate.componentProp.hidden" :rules="formData.deptManagerDate.rules">
                        <a-date-picker v-model:value="formData.deptManagerDate.componentProp.defaultValue"
                          :disabled="formData.deptManagerDate.componentProp.disabled"
                          :placeholder="formData.deptManagerDate.componentProp.placeholder" show-time type="date"
                          value-format="YYYY-MM-DD" format="YYYY-MM-DD" style="width: 100%" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">综合管理部审核意见</span></td>
              <td colspan="3">
                <a-form-item :label="formData.integratedManagerContent.label" class="hideLabel" :name="[
      formData.integratedManagerContent.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.integratedManagerContent.componentProp.hidden" :rules="formData.integratedManagerContent.rules">
                  <a-textarea v-model:value="formData.integratedManagerContent.componentProp.defaultValue"
                    :disabled="formData.integratedManagerContent.componentProp.disabled"
                    :placeholder="formData.integratedManagerContent.componentProp.placeholder" />
                </a-form-item>
                <div style="float: right; margin-top: 10px;">
                  <a-row :gutter="16">
                    <a-col :span="12">
                      <a-form-item label="签字" class=""
                        :name="[formData.integratedManagerSign.field, 'componentProp', 'defaultValue']"
                        v-if="!formData.integratedManagerSign.componentProp.hidden" :rules="formData.integratedManagerSign.rules">
                        <a-input v-model:value="formData.integratedManagerSign.componentProp.defaultValue"
                          :disabled="formData.integratedManagerSign.componentProp.disabled"
                          :placeholder="formData.integratedManagerSign.componentProp.placeholder" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item :label="formData.integratedManagerDate.label" class="hideLabel"
                        :name="[formData.integratedManagerDate.field, 'componentProp', 'defaultValue']"
                        v-if="!formData.integratedManagerDate.componentProp.hidden" :rules="formData.integratedManagerDate.rules">
                        <a-date-picker v-model:value="formData.integratedManagerDate.componentProp.defaultValue"
                          :disabled="formData.integratedManagerDate.componentProp.disabled"
                          :placeholder="formData.integratedManagerDate.componentProp.placeholder" show-time type="date"
                          value-format="YYYY-MM-DD" format="YYYY-MM-DD" style="width: 100%" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">分管副总审批意见</span></td>
              <td colspan="3">
                <a-form-item style="margin-bottom: 10px" :label="formData.deputyGeneralManagerContent.label"
                  class="hideLabel" :name="[
      formData.deputyGeneralManagerContent.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.deputyGeneralManagerContent.componentProp.hidden"
                  :rules="formData.deputyGeneralManagerContent.rules">
                  <a-textarea v-model:value="formData.deputyGeneralManagerContent.componentProp.defaultValue"
                    :disabled="formData.deputyGeneralManagerContent.componentProp.disabled"
                    :placeholder="formData.deputyGeneralManagerContent.componentProp.placeholder" />
                </a-form-item>
                <div style="float: right; margin-top: 10px;">
                  <a-row :gutter="16">
                    <a-col :span="12">
                      <a-form-item label="签字：" :name="[
      formData.deputyGeneralManagerSign.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.deputyGeneralManagerSign.componentProp.hidden" :rules="formData.deputyGeneralManagerSign.rules">
                        <a-input v-model:value="formData.deputyGeneralManagerSign.componentProp.defaultValue
      " :disabled="formData.deputyGeneralManagerSign.componentProp.disabled
      " :placeholder="formData.deputyGeneralManagerSign.componentProp.placeholder
      " />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item :label="formData.deputyGeneralManagerDate.label" class="hideLabel formTimedisplay"
                        :name="[
      formData.deputyGeneralManagerDate.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.deputyGeneralManagerDate.componentProp.hidden" :rules="formData.deputyGeneralManagerDate.rules">
                        <a-date-picker v-model:value="formData.deputyGeneralManagerDate.componentProp.defaultValue
      " :disabled="formData.deputyGeneralManagerDate.componentProp.disabled" :placeholder="formData.deputyGeneralManagerDate.componentProp.placeholder
      " show-time type="date" value-format="YYYY-MM-DD" format="YYYY年MM月DD日" style="width: 100%" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>
              </td>
            </tr>
            <tr>
              <td><span style="font-weight: bold; ">总经理审批意见</span></td>
              <td colspan="3">
                <a-form-item style="margin-bottom: 10px" :label="formData.generalManagerContent.label" class="hideLabel"
                  :name="[
      formData.generalManagerContent.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.generalManagerContent.componentProp.hidden" :rules="formData.generalManagerContent.rules">
                  <a-textarea v-model:value="formData.generalManagerContent.componentProp.defaultValue"
                    :disabled="formData.generalManagerContent.componentProp.disabled"
                    :placeholder="formData.generalManagerContent.componentProp.placeholder" />
                </a-form-item>
                <div style="float: right; margin-top: 10px;">
                  <a-row :gutter="16">
                    <a-col :span="12">
                      <a-form-item label="签字：" :name="[
      formData.generalManagerSign.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.generalManagerSign.componentProp.hidden" :rules="formData.generalManagerSign.rules">
                        <a-input v-model:value="formData.generalManagerSign.componentProp.defaultValue
      " :disabled="formData.generalManagerSign.componentProp.disabled
      " :placeholder="formData.generalManagerSign.componentProp.placeholder
      " />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item :label="formData.generalManagerDate.label" class="hideLabel formTimedisplay" :name="[
      formData.generalManagerDate.field,
      'componentProp',
      'defaultValue',
    ]" v-if="!formData.generalManagerDate.componentProp.hidden" :rules="formData.generalManagerDate.rules">
                        <a-date-picker v-model:value="formData.generalManagerDate.componentProp.defaultValue
      " :disabled="formData.generalManagerDate.componentProp.disabled" :placeholder="formData.generalManagerDate.componentProp.placeholder
      " show-time type="date" value-format="YYYY-MM-DD" format="YYYY年MM月DD日" style="width: 100%" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>
              </td>
            </tr>
          </table>
        </a-form>
    </a-config-provider>
  </div>
</template>

<script lang="ts" setup>

import { ref, reactive, watch } from "vue"
import dayjs, { Dayjs } from "dayjs"
import zhCN from "ant-design-vue/es/locale/zh_CN"
import "dayjs/locale/zh-cn"
dayjs.locale("zh-cn")
const vForm = ref()
const locale = ref(zhCN)
const formData = reactive({
  applyCode: {
    type: "input",
    field: "applyCode",
    label: "编号",
    rules: [{ required: false }],
    componentProp: {
      defaultValue: '${applyCode}',
      disabled: false,
      hidden: false,
      placeholder: "",
    },
  },
  applyUserDeptName: {
    type: 'input',
    field: 'applyUserDeptName',
    label: '申请部门',
    rules: [{
      required: true
    }],
    componentProp: {
      defaultValue: "${applyUserDeptName}",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  applyUserDeptId: {
    type: 'input',
    field: 'applyUserDeptId',
    label: '申请部门ID',
    rules: [{
      required: true
    }],
    componentProp: {
      defaultValue: "${applyUserDeptId}",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  applyUserName: {
    type: 'input',
    field: 'applyUserName',
    label: '申请人',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "${applyUserName}",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  applyUserId: {
    type: 'input',
    field: 'applyUserId',
    label: '申请人Id（隐藏）',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "${applyUserId}",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  role: {
    type: 'input',
    field: 'role',
    label: '申请人角色（隐藏）',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "${applyUserRole}",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  applyTime: {
    type: 'datepicker',
    field: 'applyTime',
    label: '申请日期',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },
  planTime: {
    type: 'datepicker',
    field: 'planTime',
    label: '计划接待时间',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },
  fromAddress: {
    type: 'textarea',
    field: 'fromAddress',
    label: '接待地点',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '',
      defaultValue: '',
      disabled: false,
      hidden: false,
    },
  },
  costBelong: {
    type: 'select',
    field: 'costBelong',
    label: '费用归属',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [
        { label: '归属部门', value: '0' },
        { label: '归属项目', value: '1' },
        { label: '归属产品', value: '2' },
        { label: '归属商机', value: '3' },
      ],
    },
  },
  belongName: {
    type: 'textarea',
    field: 'belongName',
    label: '商机/项目/产品名称',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
    },
  },
  belongCode: {
    type: 'textarea',
    field: 'belongCode',
    label: '商机/项目/产品编码',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  persons: {
    type: 'inputNumber',
    field: 'persons',
    label: '就餐总人数',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    },
  },
  money: {
    type: 'select',
    field: 'money',
    label: '人均标准',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [
        { label: '用餐一档：400元/人', value: '用餐一档：400元/人' },
        { label: '用餐二档：300元人', value: '用餐二档：300元人' },
        { label: '商务一档：500元/人', value: '商务一档：500元/人' },
        { label: '商务二档：400元/人', value: '商务二档：400元/人' },
        { label: '商务三档：300元人', value: '商务三档：300元人' },
      ],
    },
  },
  budget: {
    type: 'inputNumber',
    field: 'budget',
    label: '费用预算',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "0",
      disabled: false,
      hidden: false,
      placeholder: ""
    },
  },

  deptManagerContent: {
    type: 'textarea',
    field: 'deptManagerContent',
    label: '部门负责人意见',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  deptManagerSign: {
    type: 'input',
    field: 'deptManagerSign',
    label: '部门负责人签字',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  deptManagerDate: {
    type: 'datepicker',
    field: 'deptManagerDate',
    label: '部门负责人签字日期',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },

  integratedManagerContent: {
    type: 'textarea',
    field: 'integratedManagerContent',
    label: '综合管理部审核意见',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  integratedManagerSign: {
    type: 'input',
    field: 'integratedManagerSign',
    label: '综合管理部审核签字',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  integratedManagerDate: {
    type: 'datepicker',
    field: 'integratedManagerDate',
    label: '综合管理部审核日期',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },


  deputyGeneralManagerContent: {
    type: 'textarea',
    field: 'deputyGeneralManagerContent',
    label: '分管副总意见',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  deputyGeneralManagerSign: {
    type: 'input',
    field: 'deputyGeneralManagerSign',
    label: '分管副总签字',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  deputyGeneralManagerDate: {
    type: 'datepicker',
    field: 'deputyGeneralManagerDate',
    label: '分管副总签字日期',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },
  generalManagerContent: {
    type: 'textarea',
    field: 'generalManagerContent',
    label: '总经理意见',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  generalManagerSign: {
    type: 'input',
    field: 'generalManagerSign',
    label: '总经理签字',
    rules: [{ required: true }],
    componentProp: {
      defaultValue: "",
      disabled: false,
      hidden: false,
      placeholder: ""
    }
  },
  generalManagerDate: {
    type: 'datepicker',
    field: 'generalManagerDate',
    label: '总经理签字日期',
    rules: [{ required: true }],
    componentProp: {
      placeholder: '请输入',
      defaultValue: '',
      disabled: false,
      hidden: false,
      option: [],
    },
  },
  reason: {
    type: 'textarea',
    field: 'reason',
    label: '接待事由',
    rules: [{ required: false }],
    componentProp: {
      placeholder: '',
      defaultValue: '',
      disabled: false,
      hidden: false,
    },
  },
  belongBtn: {
    type: 'button',
    field: 'belongBtn',
    label: '选择项目按钮',
    componentProp: {
      placeholder: '',
      defaultValue: false,
      disabled: false,
      hidden: false,
    },
  },
  belongFlag: {
    type: 'input',
    field: 'belongFlag',
    label: '选择项目Flag(内部用,请勿配置)',
    rules: [{ required: false }],
    componentProp: {
      placeholder: '',
      defaultValue: false,
      disabled: false,
      hidden: false,
    },
  },

})
const submitForm = () => {
  return vForm.value.validate();
}

//费用归属发生变化处理
const costBelongValue = ref('')
costBelongValue.value = formData.costBelong.componentProp.defaultValue

const costBelongChange = (val) => {
  costBelongValue.value = val
  formData.belongCode.componentProp.defaultValue = ''
  if (val == '0') {
    formData.belongName.componentProp.defaultValue = formData.applyUserDeptName?.componentProp.defaultValue
  } else {
    formData.belongName.componentProp.defaultValue = ''
  }

}
watch(
  () => formData.costBelong,
  (val) => {
    costBelongValue.value = val.componentProp.defaultValue
    // if (val.componentProp.defaultValue == '0') {
    //   formData.belongName.componentProp.defaultValue = formData.applyUserDeptName?.componentProp.defaultValue
    // }
    // 结束监听
    stop()
  },
  { deep: true, immediate: true }

);
//点击选择商机/项目/产品名称时处理
const belongClick = () => {
  formData.belongFlag.componentProp.defaultValue = true
}
//费用计算
const budgetChange=(money,persons)=>{
  if(money&&persons){
    formData.budget.componentProp.defaultValue=money.replace(/[^\d]/g, "")*persons
  }else{
    formData.budget.componentProp.defaultValue=0
  }
  
}

defineExpose({
  formData,
  submitForm
});

</script>

<style scoped>
.yk_table .ant-form-item {
  margin-bottom: 0;
}

.yk_table .ant-input-number {
  width: 100%;
}

.yk_table td {
  padding: 10px;
}

::v-deep .hideLabel .ant-form-item-label {
  display: none !important;
}

::v-deep .formTimedisplay {
  display: inline-block !important;
}

::v-deep .formTimeSpan {
  vertical-align: text-top;
  display: inline-block;
  margin: 0 10px;
}

::v-deep .ant-input-affix-wrapper-disabled,
.ant-input-affix-wrapper[disabled],
.ant-input-disabled,
.ant-input[disabled],
.ant-picker.ant-picker-disabled,
.ant-select-disabled .ant-select:not(.ant-select-customize-input) .ant-select-selector {
  background: #fff !important;
  color: #666 !important;
}

::v-deep input[disabled],
.ant-input-number-disabled {
  color: #666 !important;
  background-color: #fff !important;
}

.inlineBlock {
  display: inline-block;
}
::v-deep label{
  font-weight: bold !important;
}
</style>
